<?php
	if(isset($_GET['id'])) $id=$_GET['id'];
	require_once 'librarys/funs/class_user.php';
	$t= new tin();
	$sanpham = $t->getNewProduct("sanpham",-1,1,""," LIMIT 0,20");
	
	$lang='vi';
		if(isset($_COOKIE["lang"])) $lang=$_COOKIE["lang"];
   		else if(isset($_SESSION["lang"])) $lang=$_SESSION["lang"];
	
	include("duongdan.php");
		$rooturl="http://".$_SERVER['SERVER_NAME']."".$duongdan;
		
		$a=$_GET['a'];
		if(isset($_GET['b'])) $b=$_GET['b']; 
		$b=explode("-",$b);
		$bb=$b[count($b)-1];
		if(isset($_GET['c'])) $c=$_GET['c']; 
		$c=explode("-",$c);
		$cc=$c[count($c)-1];
		if(isset($_GET['d'])) $d=$_GET['d']; 
		$d=explode("-",$d);
		$dd=$d[count($d)-1];
		if(isset($_GET['e'])) $e=$_GET['e']; 
		$e=explode("-",$e);
		$ee=$e[count($e)-1];
		if(isset($_GET['f'])) $f=$_GET['f']; 
		$f=explode("-",$f);
		$ff=$f[count($f)-1];
		$res = $t->get_by_thutu('seo',-1,-1," and alias='$a'");	
		$row = mysql_fetch_array($res);
		$idseo=$row['id'];
?>
<?php header("Content-type: text/xml"); ?>
<?php echo "<?xml version='1.0' encoding='utf-8' ?>
	       <?xml-stylesheet type='text/xsl' href='format.xsl'?>";
?>
<rss version="2.0">
<channel>
<title>RSS-Kim Long Phát</title>
<description> RSS-Kim Long Phát </description>
<copyright> Kim Long Phát </copyright>
<generator> Kim Long Phát </generator>
<lastBuildDate> <?=gmdate("D, d m Y H:i:s")?>GMT </lastBuildDate>
<?php  while ($row_sp=mysql_fetch_assoc($sanpham)) {
	
	if($row_sp['ten_'.$lang]=='') $row_sp['ten_'.$lang]='-';
							
	$sanpham_loai = $t->get_by_thutu("sanpham_loai",$row_sp['idloai']);
	$row_l=mysql_fetch_assoc($sanpham_loai);
	$id_l=$row_l['id'];
	if($row_l['ten_'.$lang]=='') $row_l['ten_'.$lang]='-';
	
	$sanpham_chungloai = $t->get_by_thutu("sanpham_chungloai",$row_sp['idcl'],1);
	$row_cl=mysql_fetch_assoc($sanpham_chungloai);
	if($row_cl['ten_'.$lang]=='') $row_cl['ten_'.$lang]='-';
	
	$sanpham_root = $t->get_by_thutu("sanpham_root",$row_sp['idroot'],1);
	$row_root=mysql_fetch_assoc($sanpham_root);
	if($row_root['ten_'.$lang]=='') $row_root['ten_'.$lang]='-';
	
	$menu=$t->get_by_thutu("sanpham_menu",$row_sp['idmenu']);
	$row_menu=mysql_fetch_assoc($menu);
	if($row_menu['ten_'.$lang]=='') $row_menu['ten_'.$lang]='-';
?>
<item>
    <title> <?=$row_sp['ten_vi'] ?> </title>
    <description> 
            <a href="<?=$rooturl?><?=$list['15']['alias']?>/<?=convert($row_menu['ten_'.$lang])?>/<?=convert($row_root['ten_'.$lang])?>/<?=convert($row_cl['ten_'.$lang])?>/<?=convert($row_l['ten_'.$lang])?>/<?=convert($row_sp['ten_'.$lang])?>-<?=$row_sp['id']?>.html"><?=$row_sp['ten_'.$lang]?></a>    
    </description>
    <link>
    	<?=$rooturl?><?=$list['15']['alias']?>/<?=convert($row_menu['ten_'.$lang])?>/<?=convert($row_root['ten_'.$lang])?>/<?=convert($row_cl['ten_'.$lang])?>/<?=convert($row_l['ten_'.$lang])?>/<?=convert($row_sp['ten_'.$lang])?>-<?=$row_sp['id']?>.html
    </link>
    <pubDate><?=gmdate('D, d m Y H:i:s',strtotime($row_sp['ngay']) );?>  GMT</pubDate>
</item>
<?php } //while ?>
</channel>
</rss>